Skip to content

Conversation

@Tobiky
Copy link
Collaborator

@Tobiky Tobiky commented Aug 27, 2025

This PR overhauls most tests. Some tests were simply parametrized but a of LSP tests lot were modified into using a new fixture system. The new system builds each message as a fixture, or possibly modifying one, and are built into a stream at the end using e.g. build_rpc_stream. Almost all of these fixtures will be found in tests/fixtures/lsp/, with the most common found in the respective conftest.py.

These changes provide an overall more readable and maintainable test suite.

On a bonus note, it has also reduced the time it takes to run the tests.

Closes #52

Tobiky added 30 commits August 20, 2025 16:41
Adds the base life cycle (initialize, initalized, exit, shutdown, invalid request) messages into the global conftest. They are built on each fixture appending their messages into a list of notifications, requests, or responses (and a total messages) list.

The added utils include a way to build these into a BytesIO buffer based on a previous 'build_payload' function. Furthermore, adds a function to add 'find_last_request' to aid with certain related scenarios when building fixtures. Lastly, a new constant 'CONTENT_HEADER_TYPE' with the standard added header of the python-lsp-jsonrpc library.
Previously used uritools. For consistency, at least for now, its being
switched to Path.as_uri.
breaking: Added skip to test_diagnostics_when_changing_file_with_error because the server is strangely not sending any diagnostic notifications.
@Tobiky Tobiky requested a review from tagyieh August 27, 2025 21:59
@Tobiky Tobiky linked an issue Aug 27, 2025 that may be closed by this pull request
@tagyieh
Copy link
Collaborator

tagyieh commented Aug 28, 2025

I think everything is perfect, very organized and simple to understand. Great job!

(my previous comment was related to something I had misunderstood, please ignore it!)

@tagyieh tagyieh merged commit adcb0b8 into master Aug 28, 2025
4 checks passed
@Tobiky Tobiky deleted the refactor/fixture-overhaul branch August 28, 2025 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor fixtures

3 participants